package com.vivien.example.springbootdemo.dao;

import com.vivien.example.springbootdemo.pojo.Goods;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface IGoodsDao {

    @Select("select * from goods")
//    @Results({
//            @Result(column = "discrib",property = "describ")
//    })
    List<Goods> getAllGoods();

    @Select("select * from goods where goodid=#{id}")
    Goods getGoodById(int id);

    @Insert("insert into goods (goodname,discrib,goodstypeid)" +
            "values (#{goodname},#{discrib},#{goodstypeid})")
    int addGood(Goods goods);
}
